/**
 * @author Sandip J
 */
Ext.namespace('GBIF.GeoSpatial');

GBIF.GeoSpatial.WebMapPanel = function(config){

    Ext.apply(this, config, {
	        	title: "GBIF GeoSpatial Web Map"
	        ,	height: 400
	        ,	width: 600
    });
    
    GBIF.GeoSpatial.WebMapPanel.superclass.constructor.call(this, config)
}
Ext.extend(GBIF.GeoSpatial.WebMapPanel, GBIF.GeoSpatial.MapComponent, {

    loadlayers: function(){
		var url = Ext.urlDecode(location.search.substring(1))	
		this.map.setCenter(new OpenLayers.LonLat(url.lon , url.lat), url.z);
			if(url.lc != 1){
				for (var i=0; i<url.lc; i++) {
					var layer = new OpenLayers.Layer.WMS(
							url.layers[i]
						, 	url.url[i]
						,	{		
								layers:url.layers[i]
							,	opacity: 0.5 
							,	transparent: true
							,	FORMAT:url.format[i]
							}
						);
					this.map.addLayer(layer);	
				};	
			}else{
					var layer = new OpenLayers.Layer.WMS(
							url.layers
						, 	url.url
						,	{		
								layers:url.layers
							,	opacity: 0.5 
							,	transparent: true
							,	FORMAT:url.format
							}
						);
					this.map.addLayer(layer);				
			}
		}		
	});
